package com.example.demo.jvm;

/**
 * 虚拟机栈 溢出
 *
 * @author luowj12
 * @since 2021/5/25 9:27
 */
public class StackErrorMock {

    private static int index = 1;

    public void call(){
        index++;
        call();
    }

    public static void main(String[] args) {
        StackErrorMock mock = new StackErrorMock();
        try {
            mock.call();
        }catch (Throwable e){
            System.out.println("Stack deep : "+index);
            e.printStackTrace();
        }
    }

}
